import requests
from html.parser import HTMLParser


class MyHtmlParser(HTMLParser):
    is_complie = False

    def handle_starttag(self, tag, attrs):
        if tag == "a":
            for attr in attrs:
                print(attr[0] + " : " + attr[1])
                if attr[0] == "_stat2" and attr[1].startwith("filter:params|"):
                    self.is_complie = True
                    # print(attrs["href"])
                break

    def handle_data(self, data):
        if self.is_complie:
            print(data)

    def handle_endtag(self, tag):
        if tag == "a":
            self.is_complie = False


html = requests.get("https://v.qq.com/x/list/movie?offset=0&iyear=4330")
myParser = MyHtmlParser()
# print(html.text)
myParser.feed(html.text)
